CREATE TABLE [dbo].[DnnProduct_Roles]
(
[RoleID] [int] NOT NULL IDENTITY(0, 1),
[PortalID] [int] NOT NULL,
[RoleName] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[Description] [nvarchar] (1000) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[ServiceFee] [money] NULL CONSTRAINT [DF_DnnProduct_Roles_ServiceFee] DEFAULT ((0)),
[BillingFrequency] [char] (1) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[TrialPeriod] [int] NULL,
[TrialFrequency] [char] (1) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[BillingPeriod] [int] NULL,
[TrialFee] [money] NULL,
[IsPublic] [bit] NOT NULL CONSTRAINT [DF_DnnProduct_Roles_IsPublic] DEFAULT ((0)),
[AutoAssignment] [bit] NOT NULL CONSTRAINT [DF_DnnProduct_Roles_AutoAssignment] DEFAULT ((0)),
[RoleGroupID] [int] NULL,
[RSVPCode] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[IconFile] [nvarchar] (100) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[CreatedByUserID] [int] NULL,
[CreatedOnDate] [datetime] NULL,
[LastModifiedByUserID] [int] NULL,
[LastModifiedOnDate] [datetime] NULL,
[Status] [int] NOT NULL CONSTRAINT [DF_DnnProduct_Roles_Status] DEFAULT ((1)),
[SecurityMode] [int] NOT NULL CONSTRAINT [DF_DnnProduct_Roles_SecurityMode] DEFAULT ((0))
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[DnnProduct_Roles] ADD CONSTRAINT [PK_DnnProduct_Roles] PRIMARY KEY NONCLUSTERED  ([RoleID]) WITH (FILLFACTOR=85) ON [PRIMARY]
GO
ALTER TABLE [dbo].[DnnProduct_Roles] ADD CONSTRAINT [IX_DnnProduct_RoleName] UNIQUE NONCLUSTERED  ([PortalID], [RoleName]) WITH (FILLFACTOR=85) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [IX_DnnProduct_Roles] ON [dbo].[DnnProduct_Roles] ([BillingFrequency]) WITH (FILLFACTOR=85) ON [PRIMARY]
GO
ALTER TABLE [dbo].[DnnProduct_Roles] WITH NOCHECK ADD CONSTRAINT [FK_DnnProduct_Roles_DnnProduct_Portals] FOREIGN KEY ([PortalID]) REFERENCES [dbo].[DnnProduct_Portals] ([PortalID]) ON DELETE CASCADE NOT FOR REPLICATION
GO
ALTER TABLE [dbo].[DnnProduct_Roles] ADD CONSTRAINT [FK_DnnProduct_Roles_DnnProduct_RoleGroups] FOREIGN KEY ([RoleGroupID]) REFERENCES [dbo].[DnnProduct_RoleGroups] ([RoleGroupID])
GO
